package com.sxfq.loansupermarket.backsystem.modular.report.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.sxfq.loansupermarket.backsystem.common.exception.BizExceptionEnum;
import com.sxfq.loansupermarket.backsystem.common.exception.BussinessException;
import com.sxfq.loansupermarket.backsystem.core.log.LogManager;
import com.sxfq.loansupermarket.backsystem.core.log.factory.LogTaskFactory;
import com.sxfq.loansupermarket.backsystem.core.shiro.ShiroKit;
import com.sxfq.loansupermarket.backsystem.core.support.HttpKit;
import com.sxfq.loansupermarket.backsystem.core.util.StringUtil;
import com.sxfq.loansupermarket.backsystem.core.util.ToolUtil;
import com.sxfq.loansupermarket.backsystem.modular.arrival.entity.CustomerInfo;
import com.sxfq.loansupermarket.backsystem.modular.base.SqlMapper;
import com.sxfq.loansupermarket.backsystem.modular.report.dao.WholeHospitalDao;
import com.sxfq.loansupermarket.backsystem.modular.report.entity.AppointmentInfo;
import com.sxfq.loansupermarket.backsystem.modular.report.entity.SearchWholeHospitalInfo;
import com.sxfq.loansupermarket.backsystem.modular.report.entity.WholeHospitalInfo;
import com.sxfq.loansupermarket.backsystem.modular.report.service.IWholeHospitalService;
import com.sxfq.loansupermarket.backsystem.modular.report.service.IGetTotleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class WholeHospitalServiceImpl implements IWholeHospitalService {

    @Autowired
    private WholeHospitalDao dao;

    @Autowired
    private SqlMapper sqlMapper;

    @Autowired
    private IGetTotleService getTotleService;

    @Override
    public List<WholeHospitalInfo> selectPageListByQueryGetMap(Page<WholeHospitalInfo> page, SearchWholeHospitalInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getStartTime());
        }
        params.put("tableName", this.getTableName());
        return dao.getQueryPage(page, params);
    }


    @Override
    public List<WholeHospitalInfo> getCustomerAgeList(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        String sql1 = " select a.id,a.age_range from "+tableName+" a where a.arrival_time>='"+searchInfo.getStartTime()+"' and a.arrival_time<='"+searchInfo.getEndTime()+"' group by age_range order by a.age_range";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = "";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getAgeRange();
            String condition = "";
            if(classification==""||classification==null){
                condition = "b.age_range is null";
            }else{
                condition = "b.age_range='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getTcNameList(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        String sql1 = " select a.id,a.field_tc from "+tableName+" a where a.arrival_time>='"+searchInfo.getStartTime()+"' and a.arrival_time<='"+searchInfo.getEndTime()+"' group by field_tc order by a.field_tc";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = "";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getFieldTc();
            String condition = "";
            if(classification==""||classification==null){
                condition = "b.field_tc is null";
            }else{
                condition = "b.field_tc='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getOneMediumList(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        String sql1 = " select a.id,a.one_medium from "+tableName+" a where a.arrival_time>='"+searchInfo.getStartTime()+"' and a.arrival_time<='"+searchInfo.getEndTime()+"' group by one_medium order by a.one_medium";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = " ";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getOneMedium();
            String condition = "";
            if(classification==""||classification==null){
                condition = "b.one_medium is null";
            }else{
                condition = "b.one_medium='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getOneChannelList(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        String sql1 = " select a.id,a.one_channel from "+tableName+" a where a.arrival_time>='"+searchInfo.getStartTime()+"' and a.arrival_time<='"+searchInfo.getEndTime()+"' group by one_channel order by a.one_channel";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = " ";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getOneChannel();
            String condition = "";
            if(classification==""||classification==null){
                condition = "b.one_channel is null";
            }else{
                condition = "b.one_channel='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getOccupation(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        String sql1 = " select a.id,a.occupation from "+tableName+" a where a.arrival_time>='"+searchInfo.getStartTime()+"' and a.arrival_time<='"+searchInfo.getEndTime()+"' group by occupation order by a.occupation";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = " ";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getOccupation();
            String condition = "";
            if(classification==""||classification==null){
                condition = "b.occupation is null";
            }else{
                condition = "b.occupation='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getDepartment(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        String tableName1 = tableHead + "deal_info";
        String sql1 = " select a.id,c.department from "+tableName1+" a  left join \n" +
                ""+tableName+" b on a.customer_id = b.id left join pay_service_info c\n" +
                "on a.pay_service_id=c.id where b.arrival_time>='"+searchInfo.getStartTime()+"' and b.arrival_time<='"+searchInfo.getEndTime()+"' and a.deal_status!='作废' and a.deal_status!='已开单' group by c.department ";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = " ";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getDepartment();
            String condition = "";
            if(classification==""||classification==null){
                condition = "d.department is null";
            }else{
                condition = "d.department='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getDoctorList(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "deal_info";
        String sql1 = " select a.id,a.doctor from "+tableName+" a where a.operation_time>='"+searchInfo.getStartTime()+"' and a.operation_time<='"+searchInfo.getEndTime()+"' group by doctor order by a.doctor";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = "";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getDoctor();
            String condition ="";
            if(classification==""||classification==null){
                condition = "c.doctor is null";
            }else{
                condition = "c.doctor='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getPayServiceList(SearchWholeHospitalInfo searchInfo) {
        String sql1 = "select a.id,a.doctor as doctor from operation_analysis_info a group by  a.doctor";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = "";
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<WholeHospitalInfo> getCitiesList(SearchWholeHospitalInfo searchInfo) {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        String sql1 = " select a.id,a.cities from "+tableName+" a group by cities order by a.cities";
        List<SearchWholeHospitalInfo> list1 = sqlMapper.selectList(sql1, SearchWholeHospitalInfo.class);
        String sql = "";
        for (int i = 0; i < list1.size(); i++) {
            String classification = list1.get(i).getCities();
            String condition ="";
            if(classification==""||classification==null){
                condition = "b.cities is null";
            }else{
                condition = "b.cities='" + classification + "'";
            }
            sql += getTotleService.getsqlDepartment(searchInfo, classification, condition, i, list1);
        }
        sql += getTotleService.getTotleSqlDepartment(searchInfo);
        List<WholeHospitalInfo> list = sqlMapper.selectList(sql, WholeHospitalInfo.class);
        return list;
    }

    @Override
    public List<YyfxInfo> getYyfxList(){
        String sql ="select id,medical_record_number,customer_name,customer_sex as sex,customer_age,customer_phone," +
                "tc_name,first_visit_date,arrival_time,one_level_source,two_level_source,thr_level_source,create_people,arrival_time," +
                "customer_label,reservations_project,doctor ,deal_status,receivables,cash_receipts from operation_analysis_info a  order by a.arrival_time desc";
        List<YyfxInfo> list = sqlMapper.selectList(sql, YyfxInfo.class);
        return list;
    }

    @Override
    public List<YyfxInfo> getYyfxLists(){
        String sql =" select * from wh_xd_customer_info a  GROUP BY a.reservations_id order by a.arrival_time desc";
        List<YyfxInfo> list = sqlMapper.selectList(sql, YyfxInfo.class);
        return list;
    }

    @Override
    public List<AppointmentInfo> getYyList(){
        String sql =" select a.name as name, a.tel as tel, if(a.sex='男','1','2') as sex ,a.age,weixin as weixin,\n" +
                "b.name as disease,a.content as content ,if(d.name is null ,a.media_from,d.name) as mediaFrom,\n" +
                "  if(c.name is null ,a.engine,c.name)as engineFrom ,a.engine_key as engineKey,\n" +
                "a.memo as memo,a.author as author ,FROM_UNIXTIME(a.order_date) as orderDate,\n" +
                "FROM_UNIXTIME(a.addtime) as addTime,a.jiedai_content as jiedaiContent,xiaofei as xiaofei,\n" +
                "e.name as part,a.huifang as huifang, a.zhuanjia_num as zhuanjiaNum,xiaofei_content as xiaofeiContent," +
                "a.from_site as channel,a.genjin as follower, \n" +
                " ( CASE a.status\n" +
                "        WHEN 0 THEN\n" +
                "            '预约'\n" +
                "        WHEN 1 THEN\n" +
                "            '到店'\n" +
                "        ELSE\n" +
                "            '过期'\n" +
                "        END ) as status,\n" +
                "( CASE a.zhuangtai\n" +
                "        WHEN 1 THEN\n" +
                "            '预约'\n" +
                "        WHEN 2 THEN\n" +
                "            '跟进'\n" +
                "\t\t\t\tWHEN 3 THEN\n" +
                "            '待定'\n" +
                "        ELSE\n" +
                "            '过期'\n" +
                "        END ) as statuss ,a.doctor as doctor,FROM_UNIXTIME(a.order_date) as appointmentTime " +
                "from patient_56 a left join disease b on a.disease_id=b.id \n" +
                "left join engine c on a.`engine`=c.id \n" +
                "left join yyiawhyiya.media d on a.media_from=d.id\n" +
                "LEFT JOIN sys_part e on a.part_id=e.id\n" ;
//        String sql="  select * from (select a.name as name, a.tel as tel,  '徐东店' as zhuanjiaNum\n" +
//                "FROM patient_37 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '舞阳店' as zhuanjiaNum\n" +
//                "FROM patient_38 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '福星店' as zhuanjiaNum\n" +
//                "FROM patient_39 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '建始店' as zhuanjiaNum\n" +
//                "FROM patient_40 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '鹤峰店' as zhuanjiaNum\n" +
//                "FROM patient_41 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '来凤店' as zhuanjiaNum\n" +
//                "FROM patient_42 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '宣恩店' as zhuanjiaNum\n" +
//                "FROM patient_43 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '利川店' as zhuanjiaNum\n" +
//                "FROM patient_44 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '虎泉店' as zhuanjiaNum\n" +
//                "FROM patient_45 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '巴东店' as zhuanjiaNum\n" +
//                "FROM patient_46 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '金桂店' as zhuanjiaNum\n" +
//                "FROM patient_48 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '斯美尔店' as zhuanjiaNum\n" +
//                "FROM patient_50 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '白沙洲店' as zhuanjiaNum\n" +
//                "FROM patient_51 a\n" +
//                "union all \n" +
//                "select a.name as name, a.tel as tel,   '光谷店' as zhuanjiaNum\n" +
//                "FROM patient_53 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,   '汉口店' as zhuanjiaNum\n" +
//                "FROM patient_56 a ) t LIMIT 55000,108964   ";
//        String sql="select * from (select a.name as name, a.tel as tel,a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_37 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_38 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_39 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_40 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_41 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_42 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_43 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_44 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_45 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_46 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_48 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_50 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_51 a\n" +
//                "union all \n" +
//                "select a.name as name, a.tel as tel, a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_53 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,a.content as content,a.memo as memo,a.xiaofei_content as xiaofeiContent,\n" +
//                "a.jiedai_content as  jiedaiContent,a.huifang as huifang\n" +
//                "FROM patient_56 a ) t limit 0,55000";
//        String sql="select * from (select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_37 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_38 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_39 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_40 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_41 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_42 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_43 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_44 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_45 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_46 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_48 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_50 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_51 a\n" +
//                "union all \n" +
//                "select a.name as name, a.tel as tel,FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_53 a\n" +
//                "union all\n" +
//                "select a.name as name, a.tel as tel, FROM_UNIXTIME(a.order_date) as orderDate "+
//                "FROM patient_56 a ) t limit 55000,109041";
//        String sql="select name AS name,tel AS tel,zhuangtai as isLocal,FROM_UNIXTIME(order_date) AS orderDate from patient_37 a  ";
        List<AppointmentInfo> list = sqlMapper.selectList(sql, AppointmentInfo.class);
        return list;
    }

    public String getTableName() {
        String tableHead = ShiroKit.getUser().getAbbreviation();
        String tableName = tableHead + "customer_info";
        if (tableHead==""||tableHead==null) {
            LogManager.me().executeLog(LogTaskFactory.exitLog(ShiroKit.getUser().getId(), HttpKit.getIp()));
            ShiroKit.getSubject().logout();
            return "/login.html";
        }
        return tableName;
    }

}
